package org.filehanding.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by liguo on 2016/5/14.
 */
@Controller
public class RedirectController {
    @RequestMapping(value = {"/", "/index", "/index.html"}, method = RequestMethod.GET)
    public String redirectIndex() {
        return "index";
    }

    @RequestMapping(value = {"/login", "/login.html"}, method = RequestMethod.GET)
    public String redictLogin() {
        return "login";
    }

    @RequestMapping(value = "/logout", method = RequestMethod.GET)
    public String logout(HttpServletRequest httpServletRequest) {

        httpServletRequest.getSession().removeAttribute("loginUser");

        return "/";
    }

    @RequestMapping(value = {"/regist", "/regist.html"}, method = RequestMethod.GET)
    public String redictRegist() {
        return "regist";
    }

    @RequestMapping(value = ("/main"), method = RequestMethod.GET)
    public String redictMain() {
        return "main";
    }

    @RequestMapping(value = ("/download"), method = RequestMethod.GET)
    public String redictDownload() {
        return "download";
    }
}
